<template>
  <div>
    <Header :currentpage="a"></Header>
     <div class="banner">
        <ul @mouseenter='mouseEnter' @mouseleave='mouseLeave'>
            <li :class="imgshow?'active':''"><img src="../assets/home_banner1.jpg" alt=""></li>
            <li :class="imgshow?'':'active'"><img src="../assets/home_banner2.jpg" alt=""></li> 
        </ul>
        <ol>
            <li :class="imgshow?'active':''" @click='showImg1'></li>
            <li :class="imgshow?'':'active'" @click='showImg2'></li>
        </ol>
    </div>
    <main>
        <section class="impossible">
            <div class="title">
                <h3>跑腿e族 无所不能</h3>
                <p class="subtitle">出售自己的技能，查看需要的技能，只有你想不到，没有你找不到</p>
            </div>
            <div class="content">
                <div class="item item1">
                    <div class="bg"></div>
                    <p class="text">附近</p>
                </div>
                <div class="item item2">
                    <div class="bg"></div>
                    <p class="text">维修</p>
                </div>
                <div class="item item3">
                    <div class="bg"></div>
                    <p class="text">家政</p>
                </div>
                <div class="item item4">
                    <div class="bg"></div>
                    <p class="text">汽车服务</p>
                </div>
                <div class="item item5">
                    <div class="bg"></div>
                    <p class="text">都市丽人</p>
                </div>
                <div class="item item6">
                    <div class="bg"></div>
                    <p class="text">其他</p>
                </div>
            </div>
        </section>
        <div class="mid-img"></div>
        <section class="download">
            <div class="title">
                <h3>下载APP 加入跑腿e族</h3>
                <p class="subtitle">在这里你可以出售你的技能，在这里你可以解决你的难题</p>
            </div>
            <div class="content">
                <img class="phone" src="../assets/home_shouji.png" alt="">
                <img class="code" src="../assets/home_erweima.png" alt="">
                <span class="download"></span>
            </div>
        </section>
    </main>
    

    <Rightbtn></Rightbtn>
    <Footer></Footer>
  </div>
</template>

<script>
import Header from '@/components/header.vue'
import Footer from '@/components/footer.vue'
import Rightbtn from '@/components/rightbtn.vue'
export default {
    name: 'Home',
    data(){
        return{
            //当前页面索引值
            a:1,
            //图片切换
            imgshow:true,
            //图片切换定时器
            changeImg:''
        }
    },
    components:{
        Header,
        Footer,
        Rightbtn
    },
    mounted(){
        this.changeImg=setInterval(() => {
            this.imgshow=!this.imgshow
        }, 3000);
    },
    methods:{     
        showImg1(){
            this.imgshow = true
        },
        showImg2(){
            this.imgshow = false
        },
        mouseEnter(){
            clearInterval(this.changeImg)
        },
        mouseLeave(){
            this.changeImg=setInterval(() => {
                    this.imgshow=!this.imgshow
            }, 3000);
        }
    }
}
</script>
<style scoped>
.banner {
    width: 100%;
    height: 632px;
    min-width: 1200px;
    position: relative;
}

ul{
    width:100%;
    height:100%;
}
.banner ul li {
    width: 100%;
    position: absolute;
    opacity:0;
    transition:2s
}

.banner li img {
    width: 100%;
}

.banner ol {
    width: 200px;
    height: 10px;
    margin: auto;
    display: flex;
    justify-content: space-around;
    position: absolute;
    bottom: 0px;
    left: 0;
    right: 0;
}

.banner ol li {
    width: 50px;
    height: 10px;
    border-radius: 10px;
    background-color: #ccc;
}
.banner ul li.active{
    opacity: 1;
    transition:2s;   
}
.banner ol li.active {
    background-color: #ff0;
}

section {
    min-width: 1200px;
    width: 90%;
    height: 700px;
    margin: auto;
    padding: 20px;
}

section .title {
    text-align: center;
    padding: 50px 0 30px;
}

section .title h3 {
    font-size: 30px;
    color: #333333;
    height: 30px;
    line-height: 30px;
    margin-bottom: 20px;
    font-weight: normal;
}

section .title .subtitle {
    font-size: 18px;
    color: #666666;
}

.impossible .content {
    width: 80%;
    min-width: 600px;
    margin: auto;
    height: 600px;
    display: flex;
    flex-wrap: wrap;
}

.impossible .content .item {
    width: 33%;
    height: 50%;
}

.impossible .content .item .bg {
    height: 200px;
    width: 200px;
    margin: auto;
    background: url(../assets/home_icon2.png) no-repeat center center/300%;
}

.impossible .content .item .text {
    font-size: 24px;
    margin-top: 20px;
    color: #666666;
    text-align: center;
}

.impossible .content .item1 .bg {
    background-position: 0 0;
}

.impossible .content .item1:hover .bg {
    background-position: 0 -382px;

}

.impossible .content .item2 .bg {
    background-position: -196px 0;
}

.impossible .content .item2:hover .bg {
    background-position: -196px -382px;

}

.impossible .content .item3 .bg {
    background-position: -388px 0;
}

.impossible .content .item3:hover .bg {
    background-position: -388px -382px;
}

.impossible .content .item4 .bg {
    background-position: 0 -196px;
}

.impossible .content .item4:hover .bg {
    background-position: 0 -578px;
}

.impossible .content .item5 .bg {
    background-position: -196px -196px;
}

.impossible .content .item5:hover .bg {
    background-position: -196px -578px;
}

.impossible .content .item6 .bg {
    background-position: -388px -196px;
}

.impossible .content .item6:hover .bg {
    background-position: -388px -578px;
}

main .mid-img {
    height: 80px;
    background: url(../assets/home_wave.png) no-repeat center center/100% 100%;
}

.download .content {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    height: 500px;
}

.download .content .phone {
    position: absolute;
    top: 0;
    left: 150px;
}

.download .content .code {
    position: absolute;
    top: 70px;
    right: 285px;
}

.download .content .download {
    position: absolute;
    width: 200px;
    height: 60px;
    right: 290px;
    bottom: 35px;
    background: url(../assets/home_icon1.png) no-repeat center center/200%;
    background-position: 0 -354px;
}
</style>